package com.wsj.message_server.controller;

import com.wsj.message_server.entity.*;
import com.wsj.message_server.req.REQDeleteNotify;
import com.wsj.message_server.req.REQOfficiaNotifyInfo;
import com.wsj.message_server.req.REQPageInfo;
import com.wsj.message_server.service.NotifyService;
import com.wsj.message_server.utils.TokenUtil;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
@RequestMapping("/api/system/notify")
public class NotifyController {

    @Autowired
    private NotifyService service;

    @ApiOperation(value = "官方通知列表", tags = "官方通知列表")
    @PostMapping("v1/officiaNotify")
    public FFResponse<List<OfficiaNotify>> officiaNotify(@ApiParam(name = "请求参数", value = "传入json格式", required = true) @RequestBody REQPageInfo data,
                                                     HttpServletRequest request) {
        return service.officiaNotify(TokenUtil.getUid(request),data);
    }

    @ApiOperation(value = "官方通知详情", tags = "官方通知详情")
    @PostMapping("v1/officiaNotifyInfo")
    public FFResponse<OfficiaNotify> officiaNotifyInfo(@ApiParam(name = "请求参数", value = "传入json格式", required = true) @RequestBody REQOfficiaNotifyInfo data,
                                                         HttpServletRequest request) {
        return service.officiaNotifyInfo(TokenUtil.getUid(request),data);
    }

    @ApiOperation(value = "系统通知列表", tags = "系统通知列表")
    @PostMapping("v1/systemNotify")
    public FFResponse<List<SystemNotify>> notifyList(@ApiParam(name = "请求参数", value = "传入json格式", required = true) @RequestBody REQPageInfo data,
                                             HttpServletRequest request) {
        return service.notifyList(TokenUtil.getUid(request),data);
    }

    @ApiOperation(value = "评论通知列表", tags = "评论通知列表")
    @PostMapping("v1/commentNotify")
    public FFResponse<List<CommentNotify>> commentList(@ApiParam(name = "请求参数", value = "传入json格式", required = true) @RequestBody REQPageInfo data,
                                               HttpServletRequest request) {
        return service.commentList(TokenUtil.getUid(request),data);
    }

    @ApiOperation(value = "粉丝通知列表", tags = "粉丝通知列表")
    @PostMapping("v1/fansNotify")
    public FFResponse<List<FansNotify>> fansList(@ApiParam(name = "请求参数", value = "传入json格式", required = true) @RequestBody REQPageInfo data,
                                         HttpServletRequest request) {
        return service.fansList(TokenUtil.getUid(request),data);
    }

    @ApiOperation(value = "物料点赞通知", tags = "物料点赞通知")
    @PostMapping("v1/materialNotify")
    public FFResponse<List<MaterialNotify>> materialList(@ApiParam(name = "请求参数", value = "传入json格式", required = true) @RequestBody REQPageInfo data,
                                                 HttpServletRequest request) {
        return service.materialList(TokenUtil.getUid(request),data);
    }

    @ApiOperation(value = "通知数量", tags = "通知数量")
    @PostMapping("v1/NotifyNum")
    public FFResponse<NotifyNum> NotifyNum(HttpServletRequest request) {
        return service.NotifyNum(TokenUtil.getUid(request));
    }

    @ApiOperation(value = "通知删除", tags = "通知删除")
    @PostMapping("v1/delNotify")
    public FFResponse<String> delNotify(@ApiParam(name = "请求参数", value = "传入json格式", required = true) @RequestBody REQDeleteNotify data,
                                                     HttpServletRequest request) {
        return service.delNotify(TokenUtil.getUid(request),data);
    }

    @ApiOperation(value = "订单通知列表", tags = "订单通知列表")
    @PostMapping("v1/orderNotify")
    public FFResponse<List<OrderNotify>> orderNotify(@ApiParam(name = "请求参数", value = "传入json格式", required = true) @RequestBody REQPageInfo data,
                                                         HttpServletRequest request) {
        return service.orderNotify(TokenUtil.getUid(request),data);
    }
}
